package main

import (
	"fmt"
	"k8sops/pkg/apis"
	"k8sops/pkg/common"
	"k8sops/pkg/router"
	"k8sops/pkg/utils"
	"log"

	"github.com/gin-gonic/gin"
)

func main() {
	// 启动 agent
	go apis.OpsAgents()

	// 启动 gin
	engine := gin.Default()
	engine.Use(utils.Cors())
	router.InitRouter(engine)
	err := engine.Run(fmt.Sprintf("%s:%d", common.GetConfig().Server.Host, common.GetConfig().Server.Port))
	if err != nil {
		log.Panic(err.Error())
		return
	}
}
